﻿@using LeadMaster.Helpers
@using LeadMaster.Controllers
@model LeadMaster.ViewModels.ViewModelQC


<script type="text/javascript" src="../../Scripts/jquery.fileupload.js"></script>

<style type="text/css">
.InfoRowHeight
{
    height: 20px;   
}
.sectionheader
{
    font-size: 9px;
    text-align: left;
 }
 .topsectiontitles
 {
    text-align: left;
    background-color: #BFFFFF;
 }
</style>
<label>@Model.Leads.Company.Company,@Model.Leads.Company.Address1,@Model.Leads.Company.Town</label><br />
<label>Lead Type : @Model.Leads.Sector.Sector</label><br />
<div>
@if (Model.Leads.ScheduleTemplate.AgreementReport == null)
{
<label style="font-family: 'Trebuchet MS'; font-style: italic; color: #FF00FF">Please report error to Development department and report a Null Schedule Template Agreement Report</label>
}
else
{
<a href="@(System.Configuration.ConfigurationManager.AppSettings["ReportServerURL"])@(Model.Leads.ScheduleTemplate.AgreementReport)&rs:Command=Render&LeadID=@(Model.Leads.LeadID)&rc:Parameters=false" target="_blank">
<label style="font-style: italic; cursor: pointer">View Agreement</label>
</a>
}
</div>
<div>
<a href="@(System.Configuration.ConfigurationManager.AppSettings["ReportServerURL"])AllClientLeads&rs:Command=Render&leadid=@(Model.Leads.LeadID)" target="_blank">
<label style="font-style: italic; cursor: pointer">View All Leads For This Client</label>
</a>
</div>
@if (Model.Leads.bulletpoint!=null)
{
<label style="color: #666666;font-style: italic;">Bullet Points</label>    
<div id="dialogBulletPoints">
<textarea style="width: 500px;color: #666666;font-style: italic;">@(Model.Leads.bulletpoint)</textarea>
</div>    
}
<table>
<tr class="InfoRowHeight">
<td><label>Client</label></td>
<td><label style="font-weight:bold; color: #000000; cursor: pointer;" id="qcclient" data-leadid="@(@Model.Leads.LeadID)">@Model.Leads.IntRef.Trim()</label></td>
</tr>
<tr class="InfoRowHeight">
<td><label>Total Leads</label></td>
<td><label style="font-weight:bold; color: #000000;">
@ViewBag.TotalLeads
</label></td>
</tr>
<tr class="InfoRowHeight">
<td><label>Date Of Leads</label></td>
<td><label style="font-weight:bold; color: #000000;">@Model.LeadDate</label></td>
</tr>
</table>
@if (@Model.FullListLeadResults != null && @Model.FullListLeadResults.Count() > 0)
{
<table style="width:1200px;">
<tr>
@for (int i = 0; i < @Model.Titles.Count(); i++)
{
    <th>
    <label style="color: #FF0000; font-size: 9px; font-family: Arial, Helvetica, sans-serif; font-weight: bold;">
    @if (Model.FullListLeadResults[i].LeadResult.LeadGroupQuestionsID != null && Model.FullListLeadResults[i].LeadResult.LeadGroupQuestionsID > 0)
    {
        if (Model.FullListLeadResults[i].LeadResult.LeadGroupQuestion.ClientNote != null)
        {
            @Model.FullListLeadResults[i].LeadResult.LeadGroupQuestion.ClientNote
        }
    }
    </label>
    </th>    
}
<th>&nbsp;</th>
<th>&nbsp;</th>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

<tr>
@{
int colSpan = 1;
string blockTitle = "";
for (int i = 0; i < @Model.Titles.Count(); i++)
{
    if (Model.FullListLeadResults[i].LeadResult.LeadStatQuestionsID != null && Model.FullListLeadResults[i].LeadResult.LeadStatQuestionsID > 0)
    {
        if (blockTitle == Model.FullListLeadResults[i].LeadResult.LeadStatQuestion.LeadStat.Title)
        {
            colSpan++;
        }
        else
        {
            if (blockTitle.Trim().Length > 0)
            {
                <th colspan="@(colSpan)" class="topsectiontitles"><label class="sectionheader">@blockTitle</label></th>                    
            }
            colSpan = 1;
            blockTitle = Model.FullListLeadResults[i].LeadResult.LeadStatQuestion.LeadStat.Title;
        }
    }
    if (Model.FullListLeadResults[i].LeadResult.LeadGroupQuestionsID != null && Model.FullListLeadResults[i].LeadResult.LeadGroupQuestionsID > 0)
    {
        if (blockTitle == Model.FullListLeadResults[i].LeadResult.LeadGroupQuestion.LeadGroups.Title)
        {
            colSpan++;
        }
        else
        {
            if (blockTitle.Trim().Length > 0)
            {
                <th colspan="@(colSpan)" class="topsectiontitles"><label class="sectionheader">@blockTitle</label></th>                
            }
            colSpan = 1;
            blockTitle = Model.FullListLeadResults[i].LeadResult.LeadGroupQuestion.LeadGroups.Title;
        }
    }
    if (Model.FullListLeadResults[i].LeadResult.CompanyRegisteredID != null && Model.FullListLeadResults[i].LeadResult.CompanyRegisteredID > 0)
    {
        if (blockTitle == "Registration")
        {
            colSpan++;
        }
        else
        {
            if (blockTitle.Trim().Length > 0)
            {
                <th colspan="@(colSpan)" class="topsectiontitles"><label class="sectionheader">@blockTitle</label></th>
            }
            colSpan = 1;
            blockTitle = "Registration";
        }
    }
    if (Model.FullListLeadResults[i].LeadResult.CompanyRestrictionsID != null && Model.FullListLeadResults[i].LeadResult.CompanyRestrictionsID > 0)
    {
        if (blockTitle == "Restriction")
        {
            colSpan++;
        }
        else
        {
            if (blockTitle.Trim().Length > 0)
            {
            <th colspan="@(colSpan)" class="topsectiontitles"><label class="sectionheader">@blockTitle</label></th>
            }
            colSpan = 1;
            blockTitle = "Restriction";
        }
    }
    if (Model.FullListLeadResults[i].LeadResult.CompanySundriesID != null && Model.FullListLeadResults[i].LeadResult.CompanySundriesID > 0)
    {
        if (blockTitle == "Sundries")
        {
            colSpan++;
        }
        else
        {
            if (blockTitle.Trim().Length > 0)
            {
            <th colspan="@(colSpan)" class="topsectiontitles"><label class="sectionheader">@blockTitle</label></th>
            }
            colSpan = 1;
            blockTitle = "Sundries";
        }
    }
} 
<th colspan="@(colSpan)" class="topsectiontitles"><label class="sectionheader">@blockTitle</label></th>
}
<th>&nbsp;</th>
<th>&nbsp;</th>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
@for (int i = 0; i < @Model.Titles.Count(); i++)
{
    <th style="background-color: #BFFFFF;">
    <label style="color: #FF0000;">
    @if (Model.FullListLeadResults[i].LeadResult.LeadStatQuestionsID != null && Model.FullListLeadResults[i].LeadResult.LeadStatQuestionsID > 0)
    {
        if (Model.FullListLeadResults[i].LeadResult.LeadStatQuestion.Mandatory == true)
        {
            @:M
        }
        else
        {
            @:I
        }
    }
    @if (Model.FullListLeadResults[i].LeadResult.LeadGroupQuestionsID != null && Model.FullListLeadResults[i].LeadResult.LeadGroupQuestionsID > 0)
    {
        if (Model.FullListLeadResults[i].LeadResult.LeadGroupQuestion.Mandatory == true)
        {
            @:M
        }
        else
        {
            @:I
        }
    }
    @if (Model.FullListLeadResults[i].LeadResult.CompanyRegisteredID != null && Model.FullListLeadResults[i].LeadResult.CompanyRegisteredID > 0)
    {
        if (Model.FullListLeadResults[i].LeadResult.CompanyRegistered.MandatoryLeadQuestion == true)
        {
            @:M
        }
        else
        {
            @:I
        }
    }
    @if (Model.FullListLeadResults[i].LeadResult.CompanyRestrictionsID != null && Model.FullListLeadResults[i].LeadResult.CompanyRestrictionsID > 0)
    {
        if (Model.FullListLeadResults[i].LeadResult.CompanyRestriction.MandatoryLeadQuestion == true)
        {
            @:M
        }
        else
        {
            @:I
        }
    }    
    @if (Model.FullListLeadResults[i].LeadResult.CompanySundriesID != null && Model.FullListLeadResults[i].LeadResult.CompanySundriesID > 0)
    {
        if (Model.FullListLeadResults[i].LeadResult.CompanySundry.MandatoryLeadQuestion == true)
        {
            @:M
        }
        else
        {
            @:I
        }
    }    
    </label>
    </th>    
}
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<td>&nbsp;</td>
<td>&nbsp;</td>

</tr>
<tr>
@for (int i = 0; i < @Model.Titles.Count(); i++)
{
    <th style="border: 1px solid #000000; background-color: #999999;">
    <label style="color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 9px;">
    @Model.Titles[i]
    </label>
    </th>    
}
<th style="border: 1px solid #000000; background-color: #999999;">
<label style="color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 9px;">
Purchase Order
</label>
</th>
<th style="border: 1px solid #000000; background-color: #999999;">
<label style="color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 9px;">
New or Replacement  
</label>
</th>
<th style="border: 1px solid #000000; background-color: #999999;">
<label style="color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 9px;">
Days Left To Return
</label>
</th>
<th style="border: 1px solid #000000; background-color: #999999;">
<label style="color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 9px;">
Current Status
</label>
</th>
<th style="border: 1px solid #000000; background-color: #999999;">
<label style="color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 9px;">
Client Return Reason
</label>
</th>
<th style="border: 1px solid #000000; background-color: #999999;">
<label style="color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 9px;">
Your Findings
</label>
</th>
<th style="border: 1px solid #000000; background-color: #999999;">
<label style="color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 9px;">
Voice File
</label>
</th>
@if (Model.Leads.DunsmorePreCheck == true)
{
<th style="border: 1px solid #000000; background-color: #999999;">
<label style="color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 9px;">
Dunsmore Validated
</label>
</th>
}
</tr>
<tr>
@{
int iCounter = 0;
int daysDiff = 0;
foreach (var item in Model.FullListLeadResults)
{
    <td style="border: 1px solid #000000;">
    <label style="color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; font-size: 9px;">
    @item.LeadResult.Answer
    </label>
    </td>
    iCounter++;
    if (iCounter == Model.QuestionBlock)
    {
        daysDiff = 5 - (Convert.ToInt16((DateTime.Now - item.LeadResult.LeadDate).TotalDays));
        daysDiff += AdditionalDays.AddLeadDays(item.LeadResult.LeadDate.DayOfWeek);
        daysDiff = daysDiff < 0 ? 0 : daysDiff;
        <text>
        <td style="border: 1px solid #000000;">
            <label style="color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 9px; font-weight: bold; cursor: pointer;" class="changeleadreason" data-id="@(item.LeadResult.LeadResultsID)" data-leadstatusid="@(item.LeadStatus.LeadStatusID)">
            @if (item.LeadStatus.PurchaseOrder != null)
            {
                @item.LeadStatus.PurchaseOrder.PID @:&nbsp; @item.LeadStatus.PurchaseOrder.CallCentre.CallCentre
            }
            else
            {
             @:&nbsp;   
            }
            </label>
            </td>
            <td style="border: 1px solid #000000;">
            <label style="color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 9px; font-weight: bold;">
            @if (item.LeadStatus.Replacement != null)
            {
                @item.LeadStatus.Replacement.ToString().Replace("True", "Replacement")
            }
            else
            {
                @:New
            }
            </label>
            </td>
            <td style="border: 1px solid #000000;">
            <label style="color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 9px; font-weight: bold;">
            @daysDiff
            </label>
            </td>
            <td style="border: 1px solid #000000;">
            <label style="color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 9px; font-weight: bold; cursor: pointer;" 
            class="changeleadstatus" data-id="@(item.LeadResult.LeadResultsID)" data-leadstatusid="@(item.LeadStatus.LeadStatusID)" id="status@(item.LeadStatus.LeadStatusID)">
            @item.LeadFlag.Description
            </label>
            </td>
            <td style="border: 1px solid #000000;">
            @if (item.LeadReason.LeadReasonsID > 1)
            {
            <label style="color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 9px; font-weight: bold; cursor: pointer;" 
            class="changeleadreason" data-id="@(item.LeadResult.LeadResultsID)" id="reason@(item.LeadStatus.LeadStatusID)" data-leadstatusid="@(item.LeadStatus.LeadStatusID)">
            @item.LeadReason.Description
            @if (item.LeadReason.Description == "Mandatory information wrong")
            {
               @: : @item.LeadStatus.Manfield
            }
            </label>
            }
            else
            {
             @:&nbsp;   
            }    
            </td>
            <td style="border: 1px solid #000000;">
            <textarea rows="4" cols="100" style="color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 9px ! important; font-weight: bold; cursor: pointer; width:200px;"
             class="changeleadreason" data-id="@(item.LeadResult.LeadResultsID)" id="notes@(item.LeadStatus.LeadStatusID)" data-leadstatusid="@(item.LeadStatus.LeadStatusID)" readonly>
@if (item.QCReason != null && item.LeadStatus.QCLeadReasonsID>1)
{
    if (item.QCReason == "Mandatory information wrong")
    {
@item.LeadStatus.QCManfield
    }
    else
    {
@item.QCReason
    }
@:&nbsp;
}
@item.LeadStatus.Notes
@if (item.LeadStatus.OutsourcerNotes!=null)
{
    @item.LeadStatus.OutsourcerNotes
}
            </textarea>
            </td>
            <td style="border: 1px solid #000000;">
                <label id="lblfilename@(item.LeadResult.LeadResultsID)"></label>
	            <span style="font-size: 0px;" class="btn btn-success fileinput-button" id="spanupload@(item.LeadResult.LeadResultsID)">
		            <i class="glyphicon glyphicon-plus"></i>
		            <span>Save Voice File</span>
		            <input class="voxupload" id="fileupload@(item.LeadResult.LeadResultsID)" type="file" name="files[]" data-leadresultsid="@(item.LeadResult.LeadResultsID)">
	            </span>
            <label style="color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold;" data-id="@(item.LeadResult.LeadResultsID)">
            @item.LeadStatus.VoxFile
            </label>
            @if (item.LeadStatus.VoxFile != null)
            {
            <audio controls>
				<source src="@Url.Action("PlayVoxFile", "Client")/?voxFile=@(Server.UrlEncode(item.LeadStatus.VoxFile))" type="audio/mp3" />
				<p>Your browser does not support HTML 5 audio element</p>
			</audio>                
            }
            </td>
            @if (Model.Leads.DunsmorePreCheck == true)
            {
                if (item.LeadStatus.LeadFlagsID == 10)
                {    
                    <td style="border: 1px solid #000000;">
                    <input type="button" id="approve_@(item.LeadStatus.LeadStatusID)" value="Dunsmore Approve" data-leadstatusid="@(item.LeadStatus.LeadStatusID)" data-leadid="@(item.LeadResult.LeadID)" data-blockid="@(item.LeadResult.BlockId)" class="dunsmoreqcd" style="width:120px;" /><br />
                    <input type="button" id="reject_@(item.LeadStatus.LeadStatusID)" value="Dunsmore Reject" data-leadstatusid="@(item.LeadStatus.LeadStatusID)" data-leadid="@(item.LeadResult.LeadID)" data-blockid="@(item.LeadResult.BlockId)" class="dunsmorereject" style="width:120px;" />
                    </td>
                }
                else
                {
                    <td style="border: 1px solid #000000;">&nbsp;</td>
                }
            }
            <td>
                <img src="~/Images/phone_icon.png" style="height:40px; width: 40px; cursor: pointer;" class="calldetails" 
                data-leadid="@(item.LeadResult.LeadID)" data-blockid="@(item.LeadResult.BlockId)" alt="Contact Customer"/>
            </td>
            <td>
            <a style='font-family: Arial, Helvetica, sans-serif; font-size: 9px; font-style: italic; color: #800080' 
                href='https://www.google.co.uk/maps/place/@(QCController.StreetviewLatLong(item.LeadStatus.LeadStatusID))' target='_blank'>Lat/Long </a>
            <a style='font-family: Arial, Helvetica, sans-serif; font-size: 9px; font-style: italic; color: #800080' href='https://www.google.co.uk/maps/place/@(QCController.StreetviewPostcode(item.LeadStatus.LeadStatusID))' target='_blank'>Postcode </a>
            <a style='font-family: Arial, Helvetica, sans-serif; font-size: 9px; font-style: italic; color: #800080' href='https://www.epcregister.com/reportSearchAddressByPostcode.html' target='_blank'>EPC</a> | 
            <a href="@(Url.Action("EditLeadStatus"))\?leadStatusID=@(item.LeadStatus.LeadStatusID)" style="font-family: 'Trebuchet MS'; font-size: 10px; font-style: italic; color: #808000">Notes</a> | 
            <a href="@(Url.Action("EditLeadResults"))\?leadStatusID=@(item.LeadStatus.LeadStatusID)" style="font-family: 'Trebuchet MS'; font-size: 10px; font-style: italic; color: #808000">Answers</a>
            </td>
        </text>
        @:</tr><tr>
        iCounter = 0;
    }
}
}
</tr>
</table>
<br />    
<div class="progress">
	<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
		<span class="sr-only">0% Complete</span>
	</div>
</div>    

}
else
{
<h3>No Leads have been Returned by the Client yet.</h3>
}


<div id="changestatus"></div>
<div id="changereason"></div>
<div id="callinfo"></div>
<div id="clientinfo"></div>
<input type="hidden" id="selectedelement" value="" />

<script type="text/javascript">

        $('#leadslist').hide();
        $('#orderslist').hide();
        $('#diarylist').hide();

        $("#changestatus").dialog(
    {
        autoOpen: false,
        width: 600,
        open: function () { $(".ui-dialog").css("box-shadow", "#000 5px 5px 5px"); },
        position: ['middle', 20],
        modal: true,
        dialogClass: 'notitle',
        buttons: {
            save: function () {
                $("#formChangeLeadStatus").submit();
                $(this).dialog("close");
                UpdateStatus($("#selectedelement").val());
            },
            cancel: function () {
                $(this).dialog("close");
            }
        }
    });

        $("#changereason").dialog(
    {
        autoOpen: false,
        width: 900,
        height: 600,
        open: function () { $(".ui-dialog").css("box-shadow", "#000 5px 5px 5px"); },
        position: ['middle', 20],
        modal: true,
        dialogClass: 'notitle',
        buttons: {
            save: function () {
                $(this).dialog("close");
                $("#formChangeReason").submit();
                UpdateReason($("#selectedelement").val());
            },
            cancel: function () {
                $(this).dialog("close");
            }
        }
    });

        $("#callinfo").dialog(
        {
            autoOpen: false,
            width: 600,
            open: function () { $(".ui-dialog").css("box-shadow", "#000 5px 5px 5px"); },
            position: ['middle', 20],
            modal: true,
            dialogClass: 'notitle',
            buttons: {
                cancel: function () {
                    $(this).dialog("close");
                }
            }
        });

        $("#clientinfo").dialog(
        {
            autoOpen: false,
            width: 600,
            open: function () { $(".ui-dialog").css("box-shadow", "#000 5px 5px 5px"); },
            position: ['middle', 20],
            modal: true,
            dialogClass: 'notitle',
            buttons: {
                cancel: function () {
                    $(this).dialog("close");
                }
            }
        });


        $(".changeleadstatus").click(function () {
            var leadStatusID=$(this).data("leadstatusid");
            $("#selectedelement").val(leadStatusID);
            $("#changestatus").dialog("open");
            $('#changestatus').html('<div style="text-align: center;"><div><img src="@Url.Content("~/Images/ajaxspinner_large.gif")" alt="Loading..." style="margin: 20px;" /></div><div>Loading...</div></div>');
            var contactURL = '@(Url.Action("ChangeLeadStatus", "QC"))/?id=' + $(this).data("id");
            $('#changestatus').load(contactURL);
        });

        function UpdateStatus(leadstatusid)
        {
            alert("Status changed");
            $.getJSON("UpdateStatus",{leadStatusID: leadstatusid},function(data)
            {
            $("#status" + leadstatusid).text(data.Status);
            });
        }

        $(".changeleadreason").click(function () {
            var leadStatusID=$(this).data("leadstatusid");
            $("#selectedelement").val(leadStatusID);
            $("#changereason").dialog("open");
            $('#changereason').html('<div style="text-align: center;"><div><img src="@Url.Content("~/Images/ajaxspinner_large.gif")" alt="Loading..." style="margin: 20px;" /></div><div>Loading...</div></div>');
            var contactURL = '@(Url.Action("ChangeLeadReason", "QC"))/?id=' + $(this).data("id");
            $('#changereason').load(contactURL);
        });

        function UpdateReason(leadstatusid)
        {
            alert("Reason updated");
            $.getJSON("UpdateReason",{leadStatusID: leadstatusid},function(data)
            {
            $("#reason" + leadstatusid).text(data.theReason);
            $("#notes" + leadstatusid).text(data.theNote);
            });
        }

        function UpdateElement(elementToUpdate)
        {
            var ans=confirm("Status Changed")
            if (ans==true) {
            $.ajax({
                type: "GET",
                url: "@(Url.Action("UpdateElement", "Client"))/?currentElement=" + elementToUpdate.replace(/["]/g, "'"),
                success: function(data){
                successfunc(data, elementToUpdate.replace(/["]/g, ""));
                }
            });
            }
        }

        $('.calldetails').click(function () {
            $("#callinfo").dialog("open");
            $('#callinfo').html('<div style="text-align: center;"><div><img src="@Url.Content("~/Images/ajaxspinner_large.gif")" alt="Loading..." style="margin: 20px;" /></div><div>Loading...</div></div>');
            var contactURL = '@(Url.Action("CallInfo", "QC"))/?leadID=' + $(this).data("leadid") + "&blockID=" + $(this).data("blockid");
            $('#callinfo').load(contactURL);
        });

        $('#qcclient').click(function () {
            $("#clientinfo").dialog("open");
            $('#clientinfo').html('<div style="text-align: center;"><div><img src="@Url.Content("~/Images/ajaxspinner_large.gif")" alt="Loading..." style="margin: 20px;" /></div><div>Loading...</div></div>');
            var contactURL = '@(Url.Action("ClientInfo", "QC"))/?leadID=' + $(this).data("leadid");
            $('#clientinfo').load(contactURL);
        });

        $('.dunsmoreqcd').click(function () {
            $.ajax({
                type: "GET",
                url: '@(Url.Action("DunsmoreQCD", "QC"))/?leadID=' + $(this).data("leadid") + "&blockID=" + $(this).data("blockid")
            });
            var leadstatusid = $(this).data("leadstatusid");
            $("<label>Accepted</label>").insertAfter($("#reject_" + leadstatusid.toString()));
            $("#reject_" + leadstatusid.toString()).toggle("slow");
            $(this).toggle("slow");
        });

        $('.dunsmorereject').click(function () {
            $.ajax({
                type: "GET",
                url: '@(Url.Action("DunsmoreReject", "QC"))/?leadID=' + $(this).data("leadid") + "&blockID=" + $(this).data("blockid")
            });
            var leadstatusid = $(this).data("leadstatusid");
            $("<label>Rejected</label>").insertAfter($(this));
            $("#approve_" + leadstatusid.toString()).toggle("slow");
            $(this).toggle("slow");
        });

        $('.voxupload').fileupload({
            dataType: 'json',
            url: '/QC/UploadVoxFile',
            autoUpload: true,
            done: function (e, data) {
                $.ajax({
                    url: "/QC/RegisterVoxFile",
                    type: "POST",
                    data: {
                        id: $(this).data("leadresultsid"),
                        filename: data.result.name
                    }
                });
                $('#lblfilename' + $(this).data("leadresultsid")).text(data.result.name);
                $('#spanupload' + $(this).data("leadresultsid")).hide();
            }
        }).on('fileuploadprogressall', function (e, data) {
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('.progress .progress-bar').css('width', progress + '%');
        });

        $('#btnBulletPoints').click(function () {
            $("#dialogBulletPoints").dialog("open");
        });

</script>